/**
 * Copyright (C), 2015-2021, XXX有限公司
 * FileName: MyOrderActivity
 * Author: Gxjkz
 * Date: 2021/7/26 18:32
 * Description: 我的订单
 * History:
 * <author> <time> <version> <desc>
 * 作者姓名 修改时间 版本号 描述
 */
package com.niuxiaofa.newlaw.Activity;

import android.widget.ImageView;

import androidx.recyclerview.widget.RecyclerView;

import com.androidkun.xtablayout.XTabLayout;
import com.niuxiaofa.newlaw.Base.BaseActivity;
import com.niuxiaofa.newlaw.Bean.BaseBean;
import com.niuxiaofa.newlaw.R;
import com.niuxiaofa.newlaw.Tools.RecyclerViewHelp;
import com.niuxiaofa.newlaw.Tools.ToActivityUtil;
import com.niuxiaofa.newlaw.Tools.UIUtils;
import com.niuxiaofa.newlaw.adapter.MyOrderAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import sakura.bottommenulibrary.bottompopfragmentmenu.BottomMenuFragment;
import sakura.bottommenulibrary.bottompopfragmentmenu.MenuItem;

/**
 * @ClassName: MyOrderActivity
 * @Description: 我的订单
 * @Author: Gxjkz
 * @Date: 2021/7/26 18:32
 */
public class MyOrderActivity extends BaseActivity {

    @BindView(R.id.tablayout_holder)
    XTabLayout tablayout_holder;

    @BindView(R.id.demandservice)
    ImageView demandservice;

    @BindView(R.id.shaixuan)
    ImageView shaixuan;

    @BindView(R.id.souso)
    ImageView souso;

    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;

    MyOrderAdapter myOrderAdapter;

    private String[] tabTxt = {"全部", "已完成", "未完成"};

    List<BaseBean> list=new ArrayList<>();

    @Override
    protected int getLayoutId() {
        return R.layout.activity_myorder;
    }

    @Override
    protected void initData() {

        BaseBean baseBean=new BaseBean();

        list.add(baseBean);
        list.add(baseBean);
        list.add(baseBean);
        list.add(baseBean);
        list.add(baseBean);

        myOrderAdapter=new MyOrderAdapter(list, new MyOrderAdapter.Onclick() {
            @Override
            public void onclick(int c) {

                ToActivityUtil.toNextActivity(ConsultingActivity.class);


            }
        });

        RecyclerViewHelp.setRecycler(recyclerview,0).setAdapter(myOrderAdapter);


        myOrderAdapter.notifyDataSetChanged();


        for (int i = 0; i < tabTxt.length; i++) {
            tablayout_holder.addTab(tablayout_holder.newTab().setText(tabTxt[i]));
        }

        tablayout_holder.addOnTabSelectedListener(new XTabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(XTabLayout.Tab tab) {


            }

            @Override
            public void onTabUnselected(XTabLayout.Tab tab) {


            }

            @Override
            public void onTabReselected(XTabLayout.Tab tab) {

            }
        });

        demandservice.setOnClickListener(e -> {

            ToActivityUtil.toNextActivity(DemandServiceActivity.class);

        });

        shaixuan.setOnClickListener(e -> {

            new BottomMenuFragment(UIUtils.getActivity())
                    .setTitle("标题")
                    .addMenuItems(new MenuItem("213", MenuItem.MenuItemStyle.STRESS))
                    .setOnItemClickListener((menu_item, position) -> {

                    })
                    .show();
        });

        souso.setOnClickListener(e->{

            ToActivityUtil.toNextActivity(MyOrderSearchActivity.class);

        });

    }
}